package cn.gy.productservice.mapper;

import cn.gy.common.model.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProductMapper {
    /**
     * @param productId
     * @return
     */
    @Select("select p.product_name as productName,p.price as price from tb_product.product p where id = #{productId}")
    Product findByProductId(@Param("productId") Long productId);

    /**
     * @param nm
     * @return
     */
    @Select("select p.product_name as productName,p.price as price from tb_product.product p where product_name = " +
            "#{nm}")
    Product findByProductName(@Param("nm") String nm);

    /**
     * @returna
     */
    @Select("select p.id,p.product_name as productName,p.price as price from tb_product.product p")
    List<Product> queryAllProduct();
}
